<?php

namespace App\Modules\Web\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class Register extends FormRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'mobile' => 'required|string|max:12|unique:users',
            'password' => 'required|string|min:6|confirmed',
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    public function messages()
    {
        return [
            'mobile.required' => 'A title is required',
            'mobile.mobile' => 'A title is required',
            'mobile.unique' => '已经被注册',
            'password.required'  => 'A message is required',
        ];
    }
}
